package com.github.lee.unsplash.ui.home

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.github.lee.unsplash.R
import com.github.lee.unsplash.databinding.ItemHomeBinding
import com.github.lee.unsplash.domain.PhotoBean
import com.github.lee.unsplash.manager.LoginManager
import com.github.lee.unsplash.ui.auth.WebAuthActivity

class HomeAdapter :
    BaseQuickAdapter<PhotoBean, BaseDataBindingHolder<ItemHomeBinding>>(R.layout.item_home),
    LoadMoreModule {

    init {
        addChildClickViewIds(
            R.id.iv_favorites,
            R.id.stv_download,
        )
        //        setOnItemClickListener { _, _, position ->
        //            val item = data[position]
        //            WebAuthActivity.start(context)
        //        }

    }

    override fun convert(holder: BaseDataBindingHolder<ItemHomeBinding>, item: PhotoBean) {
        holder.dataBinding?.apply {
            photo = item
        }
    }
}